<script setup>
import { computed } from 'vue'

const props = defineProps({
  title: {
    type: String,
    required: true
  },
  value: {
    type: [String, Number],
    required: true
  },
  icon: {
    type: String,
    default: 'Monitor'
  },
  type: {
    type: String,
    default: 'primary'
  }
})

const typeClass = computed(() => `card-${props.type}`)
</script>

<template>
  <el-card class="status-card" :class="typeClass">
    <div class="card-content">
      <div class="card-info">
        <h3 class="card-title">{{ title }}</h3>
        <div class="card-value">{{ value }}</div>
      </div>
      <div class="card-icon">
        <el-icon :size="40">
          <component :is="icon" />
        </el-icon>
      </div>
    </div>
  </el-card>
</template>

<style scoped>
.status-card {
  cursor: pointer;
  transition: all 0.3s;
}

.status-card:hover {
  transform: translateY(-5px);
}

.card-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-info {
  flex: 1;
}

.card-title {
  margin: 0;
  font-size: 16px;
  color: #666;
}

.card-value {
  margin-top: 8px;
  font-size: 24px;
  font-weight: bold;
}

.card-icon {
  padding: 12px;
  border-radius: 8px;
  opacity: 0.8;
}

/* 卡片类型样式 */
.card-primary .card-value,
.card-primary .card-icon {
  color: #409EFF;
}

.card-success .card-value,
.card-success .card-icon {
  color: #67C23A;
}

.card-warning .card-value,
.card-warning .card-icon {
  color: #E6A23C;
}

.card-danger .card-value,
.card-danger .card-icon {
  color: #F56C6C;
}
</style>